package com.swas.service.impl;

import com.swas.dao.BaseStaticDao;
import com.swas.dao.BaseStockDao;
import com.swas.entity.BaseStock;
import com.swas.service.BaseStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class BaseStockServiceImp implements BaseStockService {
    @Autowired
    private BaseStockDao baseStockDao;

    @Override
    public boolean add(BaseStock baseStock) {
        int i = baseStockDao.insertSelective(baseStock);
        return i>0;
    }

    @Override
    public List<BaseStock> findAll() {
        return baseStockDao.selectByExample(null);
    }

    @Override
    public boolean update(BaseStock baseStock) {
        return baseStockDao.updateByPrimaryKeySelective(baseStock)>0;
    }

    @Override
    public boolean delect(Integer id) {return baseStockDao.deleteByPrimaryKey(id)>0;}
}
